package org.pinda;

import org.johnnei.engine.GameKeyboard;
import org.johnnei.engine.IGame;
import org.lwjgl.input.Keyboard;
import org.pinda.gui.GuiController;
import org.pinda.gui.GuiLoading;
import org.pinda.gui.loading.LoadGame;

public class Pinda implements IGame {

	/**
	 * The gui which manages all gameplay gui's. This gui is used to make switching possible
	 */
	private GuiController guiHolder;
	
	@Override
	public void init() {
		GameKeyboard.getInstance().trackKey(Keyboard.KEY_LEFT);
		GameKeyboard.getInstance().trackKey(Keyboard.KEY_RIGHT);
		guiHolder = new GuiController(1920, 1080);
		guiHolder.addComponent(new GuiLoading(guiHolder, new LoadGame(guiHolder)));
	}

	@Override
	public void onTick(int deltaMs) {
		guiHolder.onTick(deltaMs);
	}

	@Override
	public void render() {
		guiHolder.render();
	}

	@Override
	public void cleanup() {
		//TODO Clean up resources
	}
	
	@Override
	public String getTitle() {
		return "Unnamed Game v0.00.1";
	}
	
	@Override
	public boolean isCloseRequested() {
		return guiHolder.isCloseRequested();
	}

}
